Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ New sniff to verify that spaces are used for mid-line alignment #942

Merged
merged 2 commits into from May 7, 2017

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented May 6, 2017

Tabs should be used at the beginning of the line for indentation, while spaces can be used mid-line for alignment.

This new sniff covers the second part of this rule. (The first part is already covered by the Generic.WhiteSpace.DisallowSpaceIndent sniff).

The error which is thrown is auto-fixable.

The new sniff has been added to the WordPress-Core ruleset.

Violations against this sniff in the WPCS codebase have been fixed.
Mostly involved getGroups() function example comments. Some of these have also been adjusted slightly to be in line with an earlier change (#812) in which these were missed and/or with the comment from the abstract parent class.

N.B.: I consider this sniff a candidate for pulling upstream to Generic in due time.

N.B.2: This sniff could probably do with some additional unit tests, but I couldn't think of any more, so ideas/code snippets welcome. (The run over the WPCS code base did not yield any incorrect fixes or false positives, so I'm not too worried)

@jrfnl jrfnl force-pushed the feature/new-use-spaces-for-alignment-sniff branch 3 times, most recently from 3f5e584 to bf5a749 Compare May 6, 2017 19:50
> Tabs should be used at the beginning of the line for indentation, while spaces can be used mid-line for alignment.

This new sniff covers the second part of this rule. (The first part is already covered by the `Generic.WhiteSpace.DisallowSpaceIndent` sniff).

The error which is thrown is auto-fixable.

The new sniff has been added to the `WordPress-Core` ruleset.
@jrfnl jrfnl force-pushed the feature/new-use-spaces-for-alignment-sniff branch from bf5a749 to 893cd78 Compare May 6, 2017 19:57
…abs` sniff.

Also brings some function group comments inline with an earlier change and/or with the comment from the abstract parent class.
* 'lambda' => array(
* 'type' => 'error' | 'warning',
* 'message' => 'Use anonymous functions instead please!',
* 'functions' => array( 'file_get_contents', 'create_function' ),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be an unrelated change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above:

Mostly involved getGroups() function example comments. Some of these have also been adjusted slightly to be in line with an earlier change (#812) in which these were missed and/or with the comment from the abstract parent class.

@JDGrimes JDGrimes merged commit c0d7578 into develop May 7, 2017
@JDGrimes JDGrimes deleted the feature/new-use-spaces-for-alignment-sniff branch May 7, 2017 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants